package com.itheima.demo02;

import java.io.FileReader;
import java.io.IOException;

public class CharClass01 {
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        FileReader fr = null;
        try {
            fr = new FileReader("day12\\a.txt");
            /*int a;
            while ((a = fr.read()) != -1) {
                System.out.println((char) a);
            }*/
            char[] chars = new char[1024];
            int len;
            while ((len = fr.read(chars)) != -1) {
                System.out.println(new String(chars,0,len));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fr != null) {
                try {
                    fr.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        long end = System.currentTimeMillis();
        System.out.println("程序运行了" + (end - start) + "毫秒！");
    }
}
